<#if packageStr ?? && packageStr!=''>
        package ${packageStr};
</#if>

import com.yunliuchain.examination.SpringTest;
import com.yunliuchain.examination.${classInfo.moduleGroup}.entity.${classInfo.firstUpperName};
import com.yunliuchain.examination.${classInfo.moduleGroup}.service.${classInfo.firstUpperName}Service;
import com.yunliuchain.examination.common.res.ApiResult;
import com.yunliuchain.examination.common.res.PageList;
 import com.yunliuchain.examination.common.req.QueryReq;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**<p>Title:<#if classInfo.remarks?? && classInfo.remarks!=''>${classInfo.remarks}<#else>${classInfo.firstUpperName?default(classInfo.firstUpperName)}</#if> 服务测试类 </p>
 * <p>Description: </p>
 * <p>作者：${author}</p>
 * <p>日期：${datetime}</p>
 * <p>版本：1.0</p>
 */
public class ${classInfo.firstUpperName}ServiceTest extends SpringTest {

    @Autowired
    private ${classInfo.firstUpperName}Service ${classInfo.className}Service;


    @Test
    public void testSave(){
        ${classInfo.className}Service.save(get${classInfo.firstUpperName}());
    }

    @Test
    public void testGet(){
        ApiResult apiResult = ${classInfo.className}Service.get(2L);
        System.out.println(apiResult);
        Assert.assertEquals(apiResult.isSuccess(),true);
    }

    @Test
    public void testUpdate(){
        ApiResult<${classInfo.firstUpperName}> apiResult = ${classInfo.className}Service.get(1L);
        ${classInfo.firstUpperName} ${classInfo.className} = apiResult.getData();
        ApiResult update = ${classInfo.className}Service.update(${classInfo.className});
        System.out.println(${classInfo.className}Service.get(1L));
        Assert.assertEquals(update.isSuccess(),true);
    }

    @Test
    public void testDelete(){
        ApiResult apiResult = ${classInfo.className}Service.del(1L);
        Assert.assertEquals(apiResult.isSuccess(),true);
    }

    @Test
    public void testList(){
        ApiResult<List<${classInfo.firstUpperName}>> list = ${classInfo.className}Service.list(null);
        System.out.println(list);
    }

    @Test
    public void testPageList(){
        PageList<${classInfo.firstUpperName}> apiResult = ${classInfo.className}Service.pageList(new QueryReq());
        System.out.println(apiResult);
    }

    private ${classInfo.firstUpperName} get${classInfo.firstUpperName}() {
        ${classInfo.firstUpperName} ${classInfo.className} = new ${classInfo.firstUpperName}();
        return ${classInfo.className};
    }
}